#include<stdio.h>
#include<stdlib.h>

typedef struct{
    int *data;
    int top;
    int cap;
}stack;

stack *init_stack(){
    stack *stack = malloc(sizeof(stack));
    stack->data = malloc(sizeof(int)*4);
    stack->cap = 4;
    stack->top = -1;
}

void push(stack *stack, int data){
    if(stack->top == stack->cap - 1){
        stack->cap *= 2;
        stack->data = realloc(stack->data, stack->cap*sizeof(int));
    }
    stack->data[++stack->top] = data;
}

int out(stack *stack){
    if(stack->top != -1)
        return stack->data[stack->top--];
    else
        return -1;
}

int main(){
    stack *stack = init_stack();
    char str[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
    //printf("%c", str[10]
    int n;
    scanf("%d", &n);
    while(n){
        push(stack, n%16);
        n /= 16;
    }
    while(stack->top != -1){
        printf("%c", str[out(stack)]);
    }
    printf("\n");
    return 0;
}